package ooday04;

public class StaticFinaDemo {
    public static void main(String[] args) {
        System.out.println(Loo.PI);
//        Loo.PI = 3.14;//静态常量不可写

        //1)加载Loo.class到方法区中
        //2)静态变量num一并存储到方法区中
        //3)到方法区中获取num的值并输出
        System.out.println(Loo.num);
        //编译器在编译时会将常量直接替换为具体的值，效率高
        //相当于System.out.println(5);
        System.out.println(Loo.COUNT);

    }
}
class Loo{
    public static final double PI = 3.1415926;
    public static int num=5;
    public static final int COUNT = 5;
}
